#include <bits/stdc++.h>
using namespace std;

int n, op;
map<string, int> mp;
string na;
int sc;

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> op;
        if (op == 1)
        {
            cin >> na >> sc;
            mp[na] = sc;
            cout << "OK" << endl;
        }
        else if (op == 2)
        {
            cin >> na;
            if (mp.count(na))
            {
                cout << mp[na] << endl;
            }
            else
            {
                cout << "Not found" << endl;
            }
        }
        else if (op == 3)
        {
            cin >> na;
            auto p = mp.find(na);
            if (p == mp.end())
            {
                cout << "Not found" << endl;
            }
            else
            {
                mp.erase(p);
                cout << "Deleted successfully" << endl;
            }
        }
        else if (op == 4)
        {
            cout << mp.size() << endl;
        }
    }
    return 0;
}